#pragma once

#include "windows_controller/MWindowsController.h"
#include "sensor_noise/sensor_noise.h"
#include "log/debug.hpp"

class Pendulum {
public:

    Pendulum(mjModel *model, mjData *data);
    ~Pendulum();

    void render();
    void updateCameraLookAt(double x); // 更新相机跟随
    void initializeNoiseSettings(); // 添加初始化噪声的方法
    
    inline mjvCamera *getCamera() { return &cam; }
    inline mjData *Data() { return d; }

    GLFWwindow *window;

public:

    mjfGeneric myController();

private:

    mjModel *m;
    mjData *d;
    mjvOption opt;
    mjvScene scn;
    mjrContext con;
    mjvCamera cam;

    MWindowsController mouseController; // 使用鼠标控制器
    sensor::NoiseManager &noiseManager; // 添加噪声管理器引用

    void initVisualization();
};
